import Vue from "vue";
import Router from "vue-router";
import NOtfind from "./components/404.vue";
import Login from "./components/HelloWorld.vue";
Vue.use(Router);
const originalPush = Router.prototype.push; //解决修改bug
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};
export default new Router({
  mode: "history",
  routes: [
    {
      path: "/",
      name: "login",
      component: Login,
      hidden: true
    },
    {
      path: "/home",
      name: "订单管理",
      redirect: "/home/order",
      iconCls: "el-icon-paperclip",
      component: resolve => require(["@/views/home.vue"], resolve),
      children: [
        {
          path: "order",
          name: "订单中心",
          component: resolve => require(["@/views/order/order"], resolve)
        }
        , {
          path: "remind",
          name: "提醒发货",
          component: resolve => require(["@/views/order/remind"], resolve)
        }
      ]
    },
    {
      path: "/home",
      name: "商品管理",
      iconCls: "el-icon-s-shop",
      component: resolve => require(["@/views/home.vue"], resolve),
      // hidden: true,
      children: [
        {
          path: "conter",
          name: "商品管理",
          component: resolve =>
            require(["@/views/commodity/commodity"], resolve)
        },
        {
          path: "classcommdity",
          name: "商品分类",
          component: resolve =>
            require(["@/views/commodity/classcommdity"], resolve)
        },
        {
          path: "addcommdity",
          name: "添加商品",
          component: resolve =>
            require(["@/views/commodity/addcommodity"], resolve)
        }
      ]
    },
    {
      path: "/home",
      name: "进销存管理",
      iconCls: "el-icon-s-platform",
      component: resolve => require(["@/views/home.vue"], resolve),
      // hidden: true,
      children: [
        {
          path: "inventory",
          name: "商品库存列表",
          component: resolve => require(["@/views/purchase/inventory"], resolve)
        },
        {
          path: "storage",
          name: "入库管理",
          component: resolve => require(["@/views/purchase/storage"], resolve)
        },
        {
          path: "addStorage",
          name: "新增入库",
          hidden: true,
          component: resolve => require(["@/views/purchase/addStorage"], resolve)
        },
        {
          path: "sale",
          name: "出库管理",
          component: resolve => require(["@/views/purchase/sale"], resolve)
        },
        {
          path: "addSale",
          name: "新增入库",
          hidden: true,
          component: resolve => require(["@/views/purchase/addSale"], resolve)
        },
        {
          path: "manage",
          name: "商品管理",
          component: resolve => require(["@/views/purchase/manage"], resolve)
        },
      ]
    },
    {
      path: "/home",
      name: "用户管理",
      iconCls: "el-icon-user-solid",
      component: resolve => require(["@/views/home.vue"], resolve),
      children: [
        {
          path: "class_user",
          name: "用户分类管理",
          component: resolve => require(["@/views/user/classuser"], resolve)
        },
        {
          path: "member_user",
          name: "会员列表",
          component: resolve => require(["@/views/user/memberUser"], resolve)
        }, {
          path: "class_user_doctor",
          name: "认证中心",
          iconCls: "el-icon-s-custom",
          component: resolve => require(["@/views/user/doctor"], resolve)
        },
      ]
    },
    {
      path: "/home",
      name: "发票管理",
      iconCls: "el-icon-s-finance",
      component: resolve => require(["@/views/home.vue"], resolve),
      children: [
        {
          path: "bill",
          name: "发票列表",
          component: resolve => require(["@/views/bill/bill"], resolve)
        },
        {
          path: "billconfig",
          name: "发票配置",
          component: resolve => require(["@/views/bill/billconfig"], resolve)
        }
      ]
    },
    {
      path: "/home",
      name: "充值管理",
      iconCls: "el-icon-s-ticket",
      component: resolve => require(["@/views/home.vue"], resolve),
      children: [
        {
          path: "prepaid",
          name: "充值列表",
          component: resolve => require(["@/views/prepaid/prepaid"], resolve)
        },
        {
          path: "preferential",
          name: "充值优惠",
          component: resolve => require(["@/views/prepaid/preferential"], resolve)
        }
      ]
    },
    {
      path: "/home",
      name: "促销商品",
      iconCls: "el-icon-s-promotion",
      component: resolve => require(["@/views/home.vue"], resolve),
      children: [
        {
          path: "activity",
          name: "活动分类",
          component: resolve => require(["@/views/promotion/activity"], resolve)
        },
        {
          path: "promotion",
          name: "促销列表",
          component: resolve => require(["@/views/promotion/promotion"], resolve)
        },
        {
          path: "dragonBoat",
          name: "端午活动",
          component: resolve => require(["@/views/promotion/dragonBoat"], resolve)
        },
        {
          path: "cashCoupon",
          name: "现金券",
          component: resolve => require(["@/views/promotion/cashCoupon"], resolve)
        },
      ]
    },
    {
      path: "/home",
      name: "评论管理",
      hidden: false,
      iconCls: "el-icon-message-solid",
      component: resolve => require(["@/views/home.vue"], resolve),
      children: [
        {
          path: "comment",
          name: "评论管理",
          component: resolve => require(["@/views/comment/comment"], resolve)
        }]
    },
    {
      path: "/home",
      name: "系统管理",
      iconCls: "el-icon-s-tools",
      component: resolve => require(["@/views/home.vue"], resolve),
      // hidden: true,
      children: [
        {
          path: "banner",
          name: "banner管理",
          component: resolve => require(["@/views/system/setbanner"], resolve)
        },
        {
          path: "discount",
          name: "折扣管理",
          component: resolve => require(["@/views/system/discount"], resolve)
        },
        {
          path: "address",
          name: "地址管理",
          component: resolve => require(["@/views/system/address"], resolve)
        }
      ]
    },
    {
      path: "/home",
      name: "权限管理",
      hidden: true,
      iconCls: "el-icon-paperclip",
      component: resolve => require(["@/views/home.vue"], resolve),
      children: [
        {
          path: "jurisdiction",
          name: "权限中心",
          component: resolve =>
            require(["@/views/jurisdiction/jurisdiction"], resolve)
        }
      ]
    },

    {
      path: "/404",
      name: "404",
      component: NOtfind,
      hidden: true
    },
    {
      path: "*",
      hidden: true,
      redirect: { path: "/404" }
    }
  ]
});
